package com.frejoys.common.request;

public class ThreadContext {

    /**
     * 构造函数私有
     */
    private ThreadContext() {}

    /**
     * 线程变量隔离
     */
    private static final ThreadLocal<AppRequest> local = new ThreadLocal<>();

    /**
     * 设置线程数据
     * @param request
     */
    public static void set(AppRequest request) {
        local.set(request);
    }

    public static AppRequest get() {
        return local.get();
    }

    /**
     * 清除线程
     */
    public static void remove() {
        local.remove();
    }

}
